//
//  DYTitleHeader.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/2/3.
//  Copyright © 2021 叁拾叁. All rights reserved.
//

import UIKit


class DYTitleHeader: SYBaseCell{
    
    var sepView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = Constant.bgViewColor
        return v
    }()

    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0x367FF6)
        v.layer.cornerRadius = 2
        return v
    }()
    
    
    let nameLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1E1E1E)
        v.font = 17.autoBoldFontSize()
        return v
    }()
    
    let chakan: UIButton = {
        let v: UIButton  = UIButton()
        v.setTitleColor(UIColor(hex: 0x5B5B5B), for: .normal)
        v.titleLabel?.font = 14.autoFontSize()
        v.layer.cornerRadius = 13.5
        v.backgroundColor = UIColor.white
        return v
    }()

    public func configureView() {
        
    }
    
    override func initViews() {
        chakan.addTarget(self, action: #selector(chakanAction), for: .touchUpInside)
        self.backgroundColor = .white
        contentView.addSubview(nameLb)
        contentView.addSubview(bgView)
        contentView.addSubview(chakan)
        
        contentView.addSubview(sepView)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(26.0.autoWidth())
            make.left.equalToSuperview().offset(autoWidth(14.5))
            make.width.equalTo(4.0.autoWidth())
            make.height.equalTo(15.0.autoWidth())
        }
        nameLb.snp.makeConstraints { (make) in
            make.centerY.equalTo(bgView)
            make.left.equalTo(bgView.snp.right).offset(autoWidth(7.0))
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.height.equalTo(16.0.autoWidth())
        }
       
        chakan.snp.makeConstraints { (make) in
            make.centerY.equalTo(nameLb).offset(3.0.autoWidth())
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.height.equalTo(30.0.autoWidth())
        }
        sepView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.right.equalToSuperview()
            make.height.equalTo(10.0.autoWidth())
        }
    }
    
    
    
    @objc func chakanAction() {
        clickedClosure?(0)
    }
}
